<script setup>
import FirstTitle from "@comp/FirstTitle";
import { onMounted } from "vue";
import PsbzTable from "@comp/llyy/PsbzTable";
import { postTableData } from "@/api/table";

const city = window.globalObj.name;

const qktjHeaders = [
  {
    label: "序号",
    prop: "rowNum",
    minWidth: "90",
  },
  {
    label: "行政区划（域）",
    prop: "jd_name",
    minWidth: "90",
  },
  {
    label: "目标名称",
    prop: "target_name",
    minWidth: "90",
  },
  {
    label: "地址",
    prop: "detailed_address",
    minWidth: "300",
  },
  {
    label: "目标等级",
    prop: "level",
    minWidth: "90",
  },
  {
    label: "目标性质",
    prop: "type",
    minWidth: "90",
  },
  {
    label: "关键防护部位",
    prop: "party_name",
    minWidth: "90",
  },
  {
    label: "联系人",
    prop: "principal",
    minWidth: "90",
  },
  {
    label: "联系电话",
    prop: "phone",
    minWidth: "90",
  },
];

const qktjList = ref([
  {
    data0: "X",
    data1: "X",
    data2: "X",
    data3: "X",
    data4: "X",
    data5: "X",
    data6: "X",
    data7: "X",
    data8: "X",
  },
]);

const dwHeaders = [
  {
    label: "序号",
    prop: "rowNum",
    minWidth: "90",
  },
  {
    label: "行政区划",
    prop: "jd_name",
    minWidth: "90",
  },
  {
    label: "重要目标名称",
    prop: "name",
    minWidth: "90",
  },
  {
    label: "专业队类型",
    prop: "type_name",
    minWidth: "300",
  },
  {
    label: "专业队子类型",
    prop: "sub_type_name",
    minWidth: "90",
  },
  {
    label: "编制",
    children: [
      {
        label: "营",
        prop: "ying",
        minWidth: "90",
      },
      {
        label: "连",
        prop: "lian",
        minWidth: "90",
      },
      {
        label: "排",
        prop: "pai",
        minWidth: "90",
      },
      {
        label: "班",
        prop: "ban",
        minWidth: "90",
      },
    ],
  },
  {
    label: "人数",
    prop: "total",
    minWidth: "90",
  },
];

const dwList = ref([
  {
    data0: "X",
    data1: "X",
    data2: "X",
    data3: "X",
    data4: "X",
    data5: "X",
    data6: "X",
    data7: "X",
    data8: "X",
    data9: "X",
  },
]);

const xqHeaders = [
  {
    label: "序号",
    prop: "rowNum",
    minWidth: "90",
  },
  {
    label: "行政区划",
    prop: "jd_name",
    minWidth: "90",
  },
  {
    label: "编组名称",
    prop: "name",
    minWidth: "90",
  },
  {
    label: "编组单位",
    prop: "bc",
    minWidth: "300",
  },
  {
    label: "战时部署位置",
    prop: "zsbswz",
    minWidth: "90",
  },
  {
    label: "指挥单位",
    prop: "zhdw",
    minWidth: "90",
  },
  {
    label: "人员数量",
    prop: "num",
    minWidth: "90",
  },
  {
    label: "主要保障任务",
    prop: "zsbzrw",
    minWidth: "90",
  },
];

const xqList = ref([
  {
    data0: "X",
    data1: "X",
    data2: "X",
    data3: "X",
    data4: "X",
    data5: "X",
    data6: "X",
    data7: "X",
  },
]);

// 重要目标情况统计表
const getQkData = () => {
  return postTableData({
    docType: "targetProtection",
    method: "zhongyaomubiaofenbuqingkuang",
  }).then((res) => {
    if (res.code === 200) {
      qktjList.value = res?.data || [];
    }
  });
};
// 重要目标单位专业力量编组表
const getDwData = () => {
  return postTableData({
    docType: "targetProtection",
    method: "zhuyeliliangbianzu",
  }).then((res) => {
    if (res.code === 200) {
      dwList.value = res?.data || [];
    }
  });
};
// 重要目标辖区内支援配属专业队
const getXqData = () => {
  return postTableData({
    docType: "targetProtection",
    method: "liliangbianchengpeizhirenwu",
  }).then((res) => {
    if (res.code === 200) {
      xqList.value = res?.data || [];
    }
  });
};

onMounted(async () => {
  await getQkData();
  await getDwData();
  await getXqData();
});
</script>
<template>
  <div class="">
    <FirstTitle :name="city + '重要目标分布图'" />
    <div class="img-box top-15 flex-justify-center-center">
      <img src="@/assets/img/zymb/fb.png" />
    </div>
    <FirstTitle :name="city + '重要目标防护构想图'" class="top-15" />
    <div class="img-box top-15 flex-justify-center-center">
      <img src="@/assets/img/zymb/gx.png" />
    </div>
    <FirstTitle :name="city + '重要目标情况统计表'" class="top-15" />
    <PsbzTable :headers="qktjHeaders" :tableData="qktjList" />
    <FirstTitle :name="city + '重要目标单位专业力量编组表'" class="top-15" />
    <PsbzTable :headers="dwHeaders" :tableData="dwList" />
    <FirstTitle :name="city + '重要目标辖区内支援配属专业队'" class="top-15" />
    <PsbzTable :headers="xqHeaders" :tableData="xqList" />
  </div>
</template>
<style scoped lang="scss"></style>